package com.dalianbank.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.dalianbank.pojo.AllTables;
import com.dalianbank.pojo.DataType;
import com.dalianbank.pojo.UI;
import com.jfinal.core.Controller;

public class MainController extends Controller {
	public void index(){
		render("/main/datatype.html");
	}
	public void getAllUI(){
		List<UI> uiList=UI.me.find("select * from vp.UI where ");
		setAttr("uiList", uiList);
		render("/main/ui.html");
	}
	public void save(UI ui){
		
	}
	public void toEo(UI ui){
		render("/main/ui.html");
	}
	public void getDataType(){
		
		List<DataType> dList=DataType.me.find("select FIRST_LETTER from vp.data_type group by FIRST_LETTER order by FIRST_LETTER");
		Map allMap=new HashMap();
		for(int i=0;i<dList.size();i++){
			Map map=new HashMap();
			DataType dt=dList.get(i);
			map.put("id", dt.getStr("FIRST_LETTER"));
			map.put("title", dt.getStr("FIRST_LETTER"));
			map.put("state", "closed");
			allMap.put("rows", map);
		}
		
		renderJson(allMap);
	}
	
	 public void findAllTable(){
		 List<AllTables> atlist=AllTables.me.find("select * from user_tables");
		 renderJson(atlist);
		 
		// return "";
		 
	 }
	
}
